package com.core.reach.cloudhub.vo;

import java.io.Serializable;

/**
 * 响应基类
 * 
 * @author xiazhijian
 * @date Apr 13, 2019 11:22:41 AM
 * 
 */
public class Response implements Serializable{

	private static final long serialVersionUID = 1973814727497218257L;

	private boolean status;

	private int responseCode = 200;

	private ErrorMessage error;

	private Object result;

	public boolean isStatus() {
		return status;
	}

	public void setStatus(boolean status) {
		this.status = status;
	}

	public int getResponseCode() {
		return responseCode;
	}

	public void setResponseCode(int responseCode) {
		this.responseCode = responseCode;
	}


	public ErrorMessage getError() {
		return error;
	}

	public void setError(ErrorMessage error) {
		this.error = error;
	}

	public Object getResult() {
		return result;
	}

	public void setResult(Object result) {
		this.result = result;
	}

	/**
	 * 构建响应
	 * 
	 * @return
	 */
	public static Response buildSuccess() {
		Response response = new Response();
		response.setStatus(true);
		return response;
	}

	/**
	 * 构建响应
	 * 
	 * @param result
	 * @return
	 */
	public static <D> Response buildSuccess(D result) {
		Response response = new Response();
		response.setStatus(true);
		response.setResult(result);
		return response;
	}
}
